function [A_center,B_center,C_center] = CLUSTER_MEAN(cluster_position,A,B,C)
%CLUSTER_MEAN will return new center points 
%   cluster_position is an array that contains the position of the clusters for
%   datasets A,B & C.

Total_clusters = max(cluster_position);  % the total number of clusters
Total_files = length(cluster_position);	% A or B or C should be same

% cleaning out old values
A_center = 0;
B_center = 0;
C_center = 0;

for i = 1:Total_clusters
    sum_A = 0;
    sum_B = 0;
    sum_C = 0;
    count = 0;
    for j = 1:Total_files
         if(cluster_position(j) == i)
             sum_A = sum_A + A(j);
             sum_B = sum_B + B(j);
             sum_C = sum_C + C(j);
             count = count + 1;
         end
    end
    A_center(i) = sum_A / count;
    B_center(i) = sum_B / count;
    C_center(i) = sum_C / count;
end

